package algorithm.utils;

import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

/**
 * @author cyt
 * @create 2020-08-23 20:23
 */
public class Integers {

    public static int[] getArr(int num, int begin, int end) {
        Random random = new Random();
        IntStream ints = random.ints(num, begin, end);
        int[] arr = new int[num];
        AtomicInteger i = new AtomicInteger();
        ints.forEach((a) -> {
            arr[i.getAndIncrement()] = a;
        });
        return arr;
    }
}
